![]() |
Java Database Programming with JDBC
by Pratik Patel Coriolis, The Coriolis Group ISBN: 1576100561 Pub Date: 10/01/96 |
Previous | Table of Contents | Next |
Variables
The JDBC driver implements this interface. The JDBC driver must create an instance of itself and then register with the DriverManager.
Methods
Method Name | Additional Description |
---|---|
public abstract boolean acceptsURL(String URL) throws SQLException | Returns true if the driver can connect to the specified database in the URL |
public abstract Connection connect(String url, Properties props) throws SQLException | Connects to the database specified in the URL with the specified Properties props |
public abstract int getMajorVersion() | Returns the JDBC drivers major version number |
public abstract int getMinorVersion() | Returns the JDBC drivers minor version number |
public abstract DriverPropertyInfo[] getPropertyInfo(String URL, Properties props) throws SQLException | Returns an array of DriverPropertyInfo that contains possible properties based on the supplied URL and props |
public abstract boolean jdbcCompliant() | Returns true if the JDBC driver can pass the JDBC compliance suite |
This object extends Statement, and it is used to perform queries that will be repeated. This class exists primarily to optimize queries that will be executed repeatedly.
Methods
Note: The set methods set the parameter at the paramIndex location in the prepared query to the specified paramType object.
Method Name | Additional Description |
---|---|
public abstract void clearParameters() throws SQLException | Resets all of the PreparedStatments query parameters |
public abstract boolean execute() throws SQLException | Runs the prepared query against the database; this method is used primarily if multiple ResultSets are expected |
public abstract ResultSet executeQuery() throws SQLException | Executes the prepared query |
public abstract int executeUpdate() throws SQLException | Executes the prepared query; this method is used for queries that do not produce a ResultSet (such as Update); returns the number or rows affected or 0 if nothing is returned by the SQL command |
public abstract void setAsciiStream(int paramIndex, InputStream paramType, int length) throws SQLException | |
public abstract void setBinaryStream(int paramIndex, InputStream paramType, int length) throws SQLException | |
public abstract void setBoolean(int paramIndex, boolean paramType) throws SQLException | |
public abstract void setByte(int paramIndex, byte paramType) throws SQLException | |
public abstract void setBytes(int paramIndex, byte paramType[]) throws SQLException | |
public abstract void setDate(int paramIndex, Date paramType) throws SQLException | |
public abstract void setDouble(int double paramType) throws SQLException | |
public abstract void setFloat(int paramIndex, float paramType) throws SQLException | |
public abstract void setInt(int paramIndex, int paramType) throws SQLException | |
public abstract void setLong(int paramIndex, long paramType) throws SQLException | |
public abstract void setNull(int paramIndex, int sqlType) throws SQLException | |
public abstract void setNumeric(int paramIndex, Numeric paramType) throws SQLException | |
public abstract void setObject(int paramIndex, Object paramType) throws SQLException | |
public abstract void setObject(int paramIndex, Object paramType, int targetSqlType) throws SQLException | |
public abstract void setObject(int paramIndex, Object paramType, int targetSqlType, int scale) throws SQLException | |
public abstract void setShort(int paramIndex, short paramType) throws SQLException | |
public abstract void setString(int paramIndex, String paramType) throws SQLException | |
public abstract void setTime(int paramIndex, Time paramType) throws SQLException | |
public abstract void setTimestamp(int TimestampparamType) throws SQLException | |
public abstract void setUnicodeStream(int paramIndexInputStream paramType, int length) throws SQLException |
The results of a query are stored in this object, which is returned when the respective query execute method is run for the Statement, PreparedStatement, and CallableStatement methods. The get methods in this class fetch the result for the specified column, but the proper data type must be matched for the column. The getMetaData method in this class can facilitate the process of checking the data type in each column of the result set.
Previous | Table of Contents | Next |